import Dynamic_Program.*;

import java.util.Scanner;



public class finish {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[9999];
        int a = sc.nextInt();
        int i=0;
        while(a>=0){
            arr[i] = a;
            a = sc.nextInt();
            i++;
        }
//        System.out.println(Fibonacci.solution(n));
//        System.out.println(Clambing_stairs.solution(n));
        House_robber hb = new House_robber();
        System.out.println(hb.solution(arr));
    }
}
